<?php
/**
 * 后台首页控制器
 * 
 */
namespace Admin\Controller;
use Think\Controller;
class IndexController extends InitController {
	
	// 仪表盘
    public function index(){
    	$topmenu = $this->topmenu;
    	$sidebarmenu = $this->sidebarmenu[I('get.k')];

   		//会员数
   		$userNum = M('User')->where(array('status'=>array('NEQ',-1)))->count();
   		//正式
   		$zs_userNum = M('User')->where(array('status'=>array('NEQ',-1),'level'=>array('NEQ',0)))->count();
   		//非正式
   		$fzs_userNum = M('User')->where(array('status'=>array('NEQ',-1),'level'=>array('EQ',0)))->count();
   		
    	//后台用户数
    	$adminNum = M('Admin')->where(array('status'=>array('NEQ',-1)))->count();
    	
    	//页面数
    	$pageNum = M('Single')->count();
    	
    	//站内文章数
    	$articleSiteNum = M('Article_site')->count();
    	
    	//文章分类数
    	$articleSiteCateNum = M('Article_cate')->count();
    	
    	//会员文章数
    	$articleNum = M('Article')->where(array('status'=>array('neq',-1)))->count();
    	
		
		//判断是否有仪表盘的权限
		if(index_check_permission(__ACTION__)){
			$this->assign('display_num',1);
		}
		
    	
    	$this->assign('userNum',$userNum);
    	$this->assign('zs_userNum',$zs_userNum);
    	$this->assign('fzs_userNum',$fzs_userNum);
    	$this->assign('adminNum',$adminNum);
    	$this->assign('pageNum',$pageNum);
    	$this->assign('articleSiteNum',$articleSiteNum);
    	$this->assign('articleSiteCateNum',$articleSiteCateNum);
    	$this->assign('articleNum',$articleNum);
    	
    	$this->assign('topmenu',$topmenu);
    	$this->assign('sidebarmenu',$sidebarmenu);
    	$this->display('Index/index');
    }
    
    // 
    
}